<template>
    <div class="header">
        <div class="header-left">
            <div class="iconfont back-icon">&#xe624;</div>
        </div>
        <div class="header-input">
            <span class="iconfont">&#xe632;</span>
            输入城市游玩主题
        </div>
        <!-- <router-view></router-view> -->
        <!-- 点击该部分 跳转到/city路由路径下 -->
        <!-- <router-view>显示的当前路由的内容
        <router-link to="/foo">实现路由的跳转 -->
        <router-link to="/city">
            <div class="header-right">
                <!-- {{this.city}} -->
                <!-- $stroe 就是刚才创建的new Vuex.Store -->
                <!-- {{this.$store.state.city}} -->
                <!-- 计算属性里的this.city  -->
                {{this.city}}
                <span class="iconfont arrow-icon">&#xe64a;</span>
            </div>
        </router-link>
    </div>
</template>
<script>
// swiper 插件  npm install vue-awesome-swiper --save
// npm install vue-awesome-swiper@2.6.7 --save 稳定版本

// 
import { mapState, mapGetters } from "vuex"
export default {
    name: 'HomeHeader',
    // props:{
    //     city:String
    // }
    computed:{
        // 展开运算符
        // 把vuex的数据映射到computed的计算属性(city)里
        ...mapState(["city"]),

        ...mapGetters(['doubleCity'])
    }
}
</script>
<style scoped lang='stylus'>
// css中引入css文件不能直接import 需要@import
// @符号 是src文件 css中需要加~ ~@
@import "~styles/varibles.styl"
// 1rem = html font-size =50px
// 原图2倍图 header高度86px  header-left 宽为32px
// 86/100 ==> rem值
.header
    display: flex
    // line-height: .86rem
    line-height: $headerHeight
    background: $bgColor
    color: #fff
    .header-left
        width: .64rem
        float: left
        .back-icon
            text-align: center
            font-size: .4rem

    .header-input
        // 自动撑开
        flex: 1
        height: .64rem
        line-height:.64rem
        margin-top:.12rem
        margin-left: .2rem
        padding-left: .2rem
        background:#fff
        border-radius: .1rem
        color: #ccc
    .header-right
        min-width: 1.04rem
        padding: 0 .1rem
        float: right 
        text-align: center
        color:#fff
        .arrow-icon
            margin-left:-0.04rem
            font-size: .24rem

</style>
